Reading Medications and Dose Events PRO
The Scripting app provides read access to the Medications a person tracks in the Health app, together with their logged dose events, using Health.queryMedications() and Health.queryMedicationDoseEvents().
Requires iOS 26.0 or later. On earlier systems both functions reject with an error.
This guide explains how to list a person's medications and how to read the doses they logged.
Medications and Dose Events
- A medication (
HealthUserAnnotatedMedication) is something the person tracks in the Health app. It carries anickname, anisArchivedflag, ahasScheduleflag, and amedicationconcept. - A medication concept (
HealthMedicationConcept) describes the medication itself: a stableidentifier, adisplayTextname, ageneralForm(such as"tablet"or"injection"), andrelatedCodings(such as RxNorm codes). - A dose event (
HealthMedicationDoseEvent) is a single logged dose — taken, skipped, snoozed, or not interacted with. It links back to a medication throughmedicationConceptIdentifier.
Permission
Medications use per-object authorization: the first time you call Health.queryMedications(), the system asks the person to choose which medications your script may access. The Scripting app requests this automatically — you don't request authorization yourself.
API Overview
Example: Listing Active Medications
Example: Reading Today's Dose Events
Example: Doses for a Specific Medication
Use a medication's identifier to fetch only its doses:
Notes
Health.queryMedications()returnsHealthUserAnnotatedMedicationinstances;Health.queryMedicationDoseEvents()returnsHealthMedicationDoseEventinstances.scheduledDateandscheduledDoseQuantityare only present for scheduled dose events (scheduleType === "schedule"); they arenullfor as-needed doses.- A dose event's
medicationConceptIdentifiermatches theidentifierof the medication's concept, so you can group doses by medication. - These APIs are read-only — medications and dose events are managed by the Health app and can't be created from a script.
Summary
- Use
Health.queryMedications()to list the medications a person tracks. - Use
Health.queryMedicationDoseEvents()to read logged doses, filtered by date, status, schedule window, or medication. - Link the two with
HealthMedicationConcept.identifier/HealthMedicationDoseEvent.medicationConceptIdentifier.
